/*     */ package com.jcrj.action.office;
/*     */ 
/*     */ import com.jcrj.action.BaseAction;
/*     */ import com.jcrj.entity.OMyOpinion;
/*     */ import com.jcrj.entity.OMyReports;
/*     */ import com.jcrj.entity.OUser;
/*     */ import com.jcrj.service.ReportService;
/*     */ import com.jcrj.service.SysLogService;
/*     */ import java.io.PrintWriter;
/*     */ import java.util.ArrayList;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import net.sf.json.JSONObject;
/*     */ 
/*     */ public class ReportAction extends BaseAction
/*     */ {
/*     */   private ReportService reportService;
/*     */   private List<OMyReports> reportsList;
/*     */   private List<OMyOpinion> opinionList;
/*     */   private OMyReports oMyReports;
/*     */   private String[] ids;
/*     */   private String tempName;
/*     */   private String users;
/*     */   private String content;
/*     */   private String note;
/*     */   private String fileArray;
/*     */   private String name;
/*     */   private String type;
/*     */   private String startDate;
/*     */   private String endDate;
/*     */   private String reportId;
/*     */   private String names;
/*     */   private int id;
/*     */   private long pageCount;
/*     */   private long totalCount;
/*     */   private SysLogService sysLogService;
/*     */ 
/*     */   public String reportList()
/*     */   {
/*  39 */     OUser ou = (OUser)super.getSession().get("userInfo");
/*  40 */     this.totalCount = this.reportService
/*  41 */       .countReport(ou.getId().intValue(), this.name, this.type, 
/*  41 */       this.startDate, this.endDate).longValue();
/*  42 */     this.pageCount = ((this.totalCount - 1L) / 10L + 1L);
/*  43 */     if (super.getCurrentPage() > this.pageCount) {
/*  44 */       super.setCurrentPage(Long.valueOf(this.pageCount).intValue());
/*     */     }
/*  46 */     this.reportsList = this.reportService.reportList(ou.getId().intValue(), this.name, this.type, this.startDate, this.endDate, super.getCurrentPage());
/*  47 */     for (int i = 0; i < this.reportsList.size(); i++) {
/*  48 */       String[] uid = ((OMyReports)this.reportsList.get(i)).getUserId().split(",");
/*  49 */       ((OMyReports)this.reportsList.get(i)).setUserName(this.reportService.getUserName(uid, null));
/*     */     }
/*  51 */     return "success";
/*     */   }
/*     */ 
/*     */   public String reportAdd() {
/*  55 */     return "success";
/*     */   }
/*     */ 
/*     */   public String saveReport() {
/*  59 */     OUser ou = (OUser)super.getSession().get("userInfo");
/*  60 */     this.reportService.saveReport(this.users, this.content, this.note, this.fileArray, this.type, ou.getId().intValue(), this.tempName);
/*  61 */     this.sysLogService.saveLog("工作汇报", ou.getName(), "添加了“" + this.content + "”汇报信息");
/*  62 */     return null;
/*     */   }
/*     */ 
/*     */   public String deleteReport() {
/*     */     try {
/*  67 */       this.reportService.deleteReport(this.ids);
/*  68 */       super.getResponse().getWriter().write("success");
/*  69 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/*  71 */       e.printStackTrace();
/*     */       try
/*     */       {
/*  74 */         super.getResponse().getWriter().close();
/*     */       } catch (Exception e1) {
/*  76 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/*  74 */         super.getResponse().getWriter().close();
/*     */       } catch (Exception e1) {
/*  76 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*  79 */     return null;
/*     */   }
/*     */ 
/*     */   public String reportUpdate() {
/*  83 */     this.oMyReports = this.reportService.getReport(Integer.parseInt(this.reportId));
/*  84 */     this.users = this.oMyReports.getUserId();
/*  85 */     List user = new ArrayList();
/*  86 */     user = this.reportService.getUserName(null, this.oMyReports.getUserId());
/*  87 */     this.names = "";
/*  88 */     for (int i = 0; i < user.size(); i++) {
/*  89 */       if (this.names == "")
/*  90 */         this.names += ((OUser)user.get(i)).getName();
/*     */       else {
/*  92 */         this.names = (this.names + "," + ((OUser)user.get(i)).getName());
/*     */       }
/*     */     }
/*  95 */     return "success";
/*     */   }
/*     */ 
/*     */   public String updateReport() {
/*  99 */     OUser ou = (OUser)super.getSession().get("userInfo");
/* 100 */     this.reportService.updateReport(this.id, this.users, this.content, this.note, this.fileArray, this.type, 
/* 101 */       ou.getId().intValue());
/* 102 */     return null;
/*     */   }
/*     */ 
/*     */   public String myLookReport() {
/* 106 */     return reportUpdate();
/*     */   }
/*     */ 
/*     */   public String reportTakeList()
/*     */   {
/* 111 */     OUser ou = (OUser)super.getSession().get("userInfo");
/* 112 */     this.totalCount = this.reportService
/* 113 */       .countTakereport(ou.getId().intValue(), this.name, this.type, 
/* 113 */       this.startDate, this.endDate).longValue();
/* 114 */     this.pageCount = ((this.totalCount - 1L) / 10L + 1L);
/* 115 */     if (super.getCurrentPage() > this.pageCount) {
/* 116 */       super.setCurrentPage(Long.valueOf(this.pageCount).intValue());
/*     */     }
/* 118 */     this.reportsList = this.reportService
/* 119 */       .getTakereportList(ou.getId().intValue(), this.name, this.type, 
/* 119 */       this.startDate, this.endDate, super.getCurrentPage());
/* 120 */     for (int i = 0; i < this.reportsList.size(); i++) {
/* 121 */       ((OMyReports)this.reportsList.get(i)).setName(
/* 122 */         this.reportService.getUserNameNew(
/* 123 */         ((OMyReports)this.reportsList.get(i)).getMyUserId().intValue()).getName());
/* 124 */       ((OMyReports)this.reportsList.get(i)).setUserName(
/* 125 */         this.reportService.getUserName(
/* 126 */         ((OMyReports)this.reportsList.get(i)).getUserId().split(","), null));
/* 127 */       ((OMyReports)this.reportsList.get(i)).setContent(this.content);
/*     */     }
/* 129 */     return "success";
/*     */   }
/*     */ 
/*     */   public String deleteTakeReport() {
/*     */     try {
/* 134 */       this.reportService.deleteTakeReport(this.ids);
/* 135 */       super.getResponse().getWriter().write("success");
/* 136 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/* 138 */       e.printStackTrace();
/*     */       try
/*     */       {
/* 141 */         super.getResponse().getWriter().close();
/*     */       } catch (Exception e1) {
/* 143 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/* 141 */         super.getResponse().getWriter().close();
/*     */       } catch (Exception e) {
/* 143 */         e.printStackTrace();
/*     */       }
/*     */     }
/* 146 */     return null;
/*     */   }
/*     */ 
/*     */   public String reportLookReply() {
/* 150 */     this.reportService.updateTakeReport(this.id, 1, 1, this.reportId);
/* 151 */     this.oMyReports = this.reportService.getReport(Integer.parseInt(this.reportId));
/* 152 */     return "success";
/*     */   }
/*     */ 
/*     */   public String saveReportOpinion() {
/*     */     try {
/* 157 */       OUser ou = (OUser)super.getSession().get("userInfo");
/* 158 */       this.reportService.saveReportOpinion(ou.getId().intValue(), this.content, ou.getName(), this.reportId);
/* 159 */       if ((this.users != null) && (!"".equals(this.users)))
/* 160 */         this.reportService.saveAgainReport(this.reportId, this.users);
/*     */     } catch (Exception e) {
/* 162 */       e.printStackTrace();
/*     */     }
/* 164 */     return null;
/*     */   }
/*     */ 
/*     */   public String opinionReoly() {
/*     */     try {
/* 169 */       super.getResponse().setCharacterEncoding("UTF-8");
/* 170 */       this.opinionList = this.reportService.getOpinionList(this.reportId);
/* 171 */       JSONObject json = new JSONObject();
/* 172 */       json.put("opinionList", this.opinionList);
/* 173 */       super.getResponse().getWriter().write(json.toString());
/* 174 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/* 176 */       e.printStackTrace();
/*     */       try
/*     */       {
/* 179 */         super.getResponse().getWriter().close();
/*     */       } catch (Exception e1) {
/* 181 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/* 179 */         super.getResponse().getWriter().close();
/*     */       } catch (Exception e) {
/* 181 */         e.printStackTrace();
/*     */       }
/*     */     }
/* 184 */     return null;
/*     */   }
/*     */ 
/*     */   public String getName()
/*     */   {
/* 189 */     return this.name;
/*     */   }
/*     */ 
/*     */   public void setName(String name) {
/* 193 */     this.name = name;
/*     */   }
/*     */ 
/*     */   public ReportService getReportService() {
/* 197 */     return this.reportService;
/*     */   }
/*     */ 
/*     */   public void setReportService(ReportService reportService) {
/* 201 */     this.reportService = reportService;
/*     */   }
/*     */ 
/*     */   public List<OMyReports> getReportsList() {
/* 205 */     return this.reportsList;
/*     */   }
/*     */ 
/*     */   public void setReportsList(List<OMyReports> reportsList) {
/* 209 */     this.reportsList = reportsList;
/*     */   }
/*     */ 
/*     */   public String getStartDate() {
/* 213 */     return this.startDate;
/*     */   }
/*     */ 
/*     */   public void setStartDate(String startDate) {
/* 217 */     this.startDate = startDate;
/*     */   }
/*     */ 
/*     */   public String getEndDate() {
/* 221 */     return this.endDate;
/*     */   }
/*     */ 
/*     */   public void setEndDate(String endDate) {
/* 225 */     this.endDate = endDate;
/*     */   }
/*     */ 
/*     */   public String getType() {
/* 229 */     return this.type;
/*     */   }
/*     */ 
/*     */   public void setType(String type) {
/* 233 */     this.type = type;
/*     */   }
/*     */ 
/*     */   public OMyReports getOMyReports() {
/* 237 */     return this.oMyReports;
/*     */   }
/*     */ 
/*     */   public void setOMyReports(OMyReports myReports) {
/* 241 */     this.oMyReports = myReports;
/*     */   }
/*     */ 
/*     */   public String getUsers() {
/* 245 */     return this.users;
/*     */   }
/*     */ 
/*     */   public void setUsers(String users) {
/* 249 */     this.users = users;
/*     */   }
/*     */ 
/*     */   public String getContent() {
/* 253 */     return this.content;
/*     */   }
/*     */ 
/*     */   public void setContent(String content) {
/* 257 */     this.content = content;
/*     */   }
/*     */ 
/*     */   public String getNote() {
/* 261 */     return this.note;
/*     */   }
/*     */ 
/*     */   public void setNote(String note) {
/* 265 */     this.note = note;
/*     */   }
/*     */ 
/*     */   public String getFileArray() {
/* 269 */     return this.fileArray;
/*     */   }
/*     */ 
/*     */   public void setFileArray(String fileArray) {
/* 273 */     this.fileArray = fileArray;
/*     */   }
/*     */ 
/*     */   public String[] getIds() {
/* 277 */     return this.ids;
/*     */   }
/*     */ 
/*     */   public void setIds(String[] ids) {
/* 281 */     this.ids = ids;
/*     */   }
/*     */ 
/*     */   public String getReportId() {
/* 285 */     return this.reportId;
/*     */   }
/*     */ 
/*     */   public void setReportId(String reportId) {
/* 289 */     this.reportId = reportId;
/*     */   }
/*     */ 
/*     */   public String getNames() {
/* 293 */     return this.names;
/*     */   }
/*     */ 
/*     */   public void setNames(String names) {
/* 297 */     this.names = names;
/*     */   }
/*     */ 
/*     */   public int getId() {
/* 301 */     return this.id;
/*     */   }
/*     */ 
/*     */   public void setId(int id) {
/* 305 */     this.id = id;
/*     */   }
/*     */ 
/*     */   public List<OMyOpinion> getOpinionList() {
/* 309 */     return this.opinionList;
/*     */   }
/*     */ 
/*     */   public void setOpinionList(List<OMyOpinion> opinionList) {
/* 313 */     this.opinionList = opinionList;
/*     */   }
/*     */ 
/*     */   public String getTempName() {
/* 317 */     return this.tempName;
/*     */   }
/*     */ 
/*     */   public void setTempName(String tempName) {
/* 321 */     this.tempName = tempName;
/*     */   }
/*     */ 
/*     */   public long getPageCount() {
/* 325 */     return this.pageCount;
/*     */   }
/*     */ 
/*     */   public void setPageCount(long pageCount) {
/* 329 */     this.pageCount = pageCount;
/*     */   }
/*     */ 
/*     */   public long getTotalCount() {
/* 333 */     return this.totalCount;
/*     */   }
/*     */ 
/*     */   public void setTotalCount(long totalCount) {
/* 337 */     this.totalCount = totalCount;
/*     */   }
/*     */ 
/*     */   public SysLogService getSysLogService() {
/* 341 */     return this.sysLogService;
/*     */   }
/*     */ 
/*     */   public void setSysLogService(SysLogService sysLogService) {
/* 345 */     this.sysLogService = sysLogService;
/*     */   }
/*     */ }

/* Location:           /Volumes/work/oa/WEB-INF/classes/
 * Qualified Name:     com.jcrj.action.office.ReportAction
 * JD-Core Version:    0.6.0
 */